package com.neusoft.boss.controller;

import com.neusoft.boss.common.returndata.OperatorReturn;
import com.neusoft.boss.common.query.LoginQuery;
import com.neusoft.boss.common.result.R;
import com.neusoft.boss.service.LoginService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 *解决跨域最简单方法加注解@CrossOrigin
 */
@RestController
public class LoginController {
    @Resource
    private LoginService loginService;
    @PostMapping("/api/login")
    public R Login(
            @RequestBody
            LoginQuery loginQuery){
   // 获取用户名密码 将登陆信息加密存入redis中
        OperatorReturn operatorReturn = loginService.select(loginQuery);

        return R.Succ(operatorReturn);
    }
}
